home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.MDIForm MainForm
- BackColor = &H00C0C0C0&
- Caption = "Mabry FTP Sample Program"
- ClientHeight = 8460
- ClientLeft = 3570
- ClientTop = 1425
- ClientWidth = 9105
- Height = 8865
- Left = 3510
- LinkTopic = "MDIForm1"
- Top = 1080
- Width = 9225
- Begin VB.PictureBox Picture3
- Align = 2 'Align Bottom
- Height = 375
- Left = 0
- ScaleHeight = 315
- ScaleWidth = 9045
- TabIndex = 9
- Top = 8085
- Width = 9105
- Begin VB.Label Label7
- Height = 180
- Left = 7695
- TabIndex = 17
- Top = 60
- Width = 1110
- End
- Begin VB.Label Label6
- Alignment = 1 'Right Justify
- Caption = "Progress:"
- Height = 165
- Left = 6735
- TabIndex = 16
- Top = 60
- Width = 855
- End
- Begin VB.Label Label5
- Alignment = 1 'Right Justify
- Caption = "State:"
- Height = 255
- Left = 1380
- TabIndex = 15
- Top = 60
- Width = 615
- End
- Begin VB.Label Label4
- Alignment = 1 'Right Justify
- Caption = "Last Error:"
- Height = 255
- Left = 2580
- TabIndex = 14
- Top = 60
- Width = 855
- End
- Begin VB.Label Label3
- Alignment = 1 'Right Justify
- Caption = "Last Action:"
- Height = 255
- Left = 60
- TabIndex = 13
- Top = 60
- Width = 855
- End
- Begin VB.Label lblState
- Caption = "Label2"
- Height = 255
- Left = 2100
- TabIndex = 12
- Top = 60
- Width = 615
- End
- Begin VB.Label lblLastError
- Caption = "Label2"
- Height = 255
- Left = 3540
- TabIndex = 11
- Top = 60
- Width = 975
- End
- Begin VB.Label lblLastAction
- Caption = "Label2"
- Height = 255
- Left = 1020
- TabIndex = 10
- Top = 60
- Width = 375
- End
- End
- Begin VB.PictureBox Picture2
- Align = 1 'Align Top
- Height = 435
- Left = 0
- ScaleHeight = 375
- ScaleWidth = 9045
- TabIndex = 3
- Top = 3975
- Width = 9105
- Begin VB.Timer Timer1
- Interval = 1
- Left = 6360
- Top = 0
- End
- Begin VB.CommandButton cmdFileTransfers
- Caption = "File Transfers"
- Height = 375
- Left = 2670
- TabIndex = 6
- Top = 0
- Width = 1335
- End
- Begin VB.CommandButton cmdDirectory
- Caption = "Directory"
- Height = 375
- Left = 1335
- TabIndex = 5
- Top = 0
- Width = 1335
- End
- Begin VB.CommandButton cmdConnection
- Caption = "Connection"
- Height = 375
- Left = 0
- TabIndex = 4
- Top = 0
- Width = 1335
- End
- Begin FTPLib.mFTP FTP1
- Left = 5760
- Top = -15
- _Version = 327680
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 0
- Blocking = -1 'True
- Debug = 1
- Host = ""
- LogonName = ""
- LogonPassword = ""
- Account = ""
- Timeout = 60
- Type = 0
- End
- End
- Begin VB.PictureBox Picture1
- Align = 1 'Align Top
- Height = 3975
- Left = 0
- ScaleHeight = 3915
- ScaleWidth = 9045
- TabIndex = 0
- Top = 0
- Width = 9105
- Begin VB.ListBox listTrace
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Courier New"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1110
- Left = 120
- TabIndex = 2
- Top = 360
- Width = 7935
- End
- Begin VB.ListBox listDir
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Courier New"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1950
- Left = 120
- TabIndex = 1
- Top = 1800
- Width = 7935
- End
- Begin VB.Label Label2
- Caption = "Dir List:"
- Height = 255
- Left = 120
- TabIndex = 8
- Top = 1560
- Width = 855
- End
- Begin VB.Label Label1
- Caption = "Trace:"
- Height = 255
- Left = 120
- TabIndex = 7
- Top = 120
- Width = 975
- End
- End
- Attribute VB_Name = "MainForm"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Dim frmLoaded As Form
- Dim cmdCurrent As CommandButton
- Dim fIgnoreListDirClick As Boolean
- Public Function ExecuteCommand(action As Integer) As Integer
- On Error Resume Next
- Ftp1.action = action
- If (Err <> 0) Then
- MsgBox Error
- End If
- ExecuteCommand = Err
- On Error GoTo 0
- End Function
- Sub LoadForm(frmNew As Form, cmdNew As CommandButton)
- If (frmNew Is frmLoaded) Then
- Exit Sub
- End If
- frmNew.Top = 0
- frmNew.Left = 0
- Load frmNew
- frmNew.Show
- If (Not frmLoaded Is Nothing) Then
- frmLoaded.Visible = False
- cmdCurrent.FontBold = False
- End If
- cmdNew.FontBold = True
- Set frmLoaded = frmNew
- Set cmdCurrent = cmdNew
- End Sub
- Private Sub cmdConnection_Click()
- LoadForm frmConnection, cmdConnection
- End Sub
- Private Sub cmdDirectory_Click()
- LoadForm frmDirectory, cmdDirectory
- End Sub
- Private Sub cmdFileTransfers_Click()
- LoadForm frmFileTransfers, cmdFileTransfers
- End Sub
- Private Sub Ftp1_Progress(ByVal BytesTransfered As Long)
- Label7.Caption = BytesTransfered
- End Sub
- Private Sub listDir_Click()
- Dim s As String
- Dim i As Integer
-
- If (fIgnoreListDirClick = True Or listDir.ListIndex < 0) Then
- Exit Sub
- End If
- s = listDir.list(listDir.ListIndex)
- i = Len(s)
- Do While (i > 1)
- If (Mid(s, i, 1) = " ") Then
- Debug.Print Mid(s, i + 1)
- SetSelectedServerFile Mid(s, i + 1)
- If (Left(s, 1) = "d" Or Left(s, 1) = "l") Then
- If (frmLoaded Is frmDirectory) Then
- frmDirectory.txtDirectory.Text = GetSelectedServerFile
- ElseIf (frmLoaded Is frmFileTransfers) Then
- frmFileTransfers.txtGetSrcFilename.Text = ""
- End If
- Else
- If (frmLoaded Is frmDirectory) Then
- frmDirectory.txtDirectory.Text = ""
- ElseIf (frmLoaded Is frmFileTransfers) Then
- frmFileTransfers.txtGetSrcFilename.Text = GetSelectedServerFile
- End If
- End If
- Exit Sub
- End If
- i = i - 1
- Loop
- End Sub
- Private Sub MDIForm_Load()
- DoEvents
- Ftp1.Type = 0
- LoadForm frmConnection, cmdConnection
- End Sub
- Private Sub Ftp1_AsyncError(ByVal ErrorNum As Long, ByVal ErrorMsg As String)
- Trace MainForm.listTrace, "Async Error:" & Str(ErrorNum) & " " & ErrorMsg
- End Sub
- Private Sub Ftp1_Debug(ByVal DebugMsg As String)
- If (Ftp1.Action <> FtpActionGetDirList And Ftp1.Action <> FtpActionGetFilenameList) Then
- Trace MainForm.listTrace, DebugMsg
- End If
- Debug.Print DebugMsg
- End Sub
- Private Sub Ftp1_DirItem(ByVal Item As String)
- fIgnoreListDirClick = True
- Trace MainForm.listDir, Item
- fIgnoreListDirClick = False
- End Sub
- Private Sub Ftp1_Done()
- Trace MainForm.listTrace, "done event fired"
- If (Ftp1.Action = 22) Then
- Trace MainForm.listTrace, Ftp1.ReadData
- End If
- End Sub
- Private Sub MDIForm_Resize()
- listTrace.Width = Me.ScaleWidth - (2 * listTrace.Left)
- listDir.Width = listTrace.Width
- End Sub
- Private Sub Timer1_Timer()
- lblLastAction.Caption = Ftp1.Action
- lblLastError.Caption = Ftp1.LastError
- lblState.Caption = Ftp1.State
- End Sub
-